package com.ruoyi.web.controller.dr;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.dr.domain.DrBase;
import com.ruoyi.dr.service.IDrBaseService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 达人列页信息Controller
 * 
 * @author ruoyi
 * @date 2025-07-12
 */
@RestController
@RequestMapping("/dr/base")
public class DrBaseController extends BaseController
{
    @Autowired
    private IDrBaseService drBaseService;

    /**
     * 查询达人列页信息列表
     */
    @PreAuthorize("@ss.hasPermi('dr:base:list')")
    @GetMapping("/list")
    public TableDataInfo list(DrBase drBase)
    {
        startPage();
        List<DrBase> list = drBaseService.selectDrBaseList(drBase);
        return getDataTable(list);
    }

    /**
     * 导出达人列页信息列表
     */
    @PreAuthorize("@ss.hasPermi('dr:base:export')")
    @Log(title = "达人列页信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DrBase drBase)
    {
        List<DrBase> list = drBaseService.selectDrBaseList(drBase);
        ExcelUtil<DrBase> util = new ExcelUtil<DrBase>(DrBase.class);
        util.exportExcel(response, list, "达人列页信息数据");
    }

    /**
     * 获取达人列页信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('dr:base:query')")
    @GetMapping(value = "/{awemeId}")
    public AjaxResult getInfo(@PathVariable("awemeId") String awemeId)
    {
        return success(drBaseService.selectDrBaseByAwemeId(awemeId));
    }

    /**
     * 新增达人列页信息
     */
    @PreAuthorize("@ss.hasPermi('dr:base:add')")
    @Log(title = "达人列页信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DrBase drBase)
    {
        return toAjax(drBaseService.insertDrBase(drBase));
    }

    /**
     * 修改达人列页信息
     */
    @PreAuthorize("@ss.hasPermi('dr:base:edit')")
    @Log(title = "达人列页信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DrBase drBase)
    {
        return toAjax(drBaseService.updateDrBase(drBase));
    }

    /**
     * 删除达人列页信息
     */
    @PreAuthorize("@ss.hasPermi('dr:base:remove')")
    @Log(title = "达人列页信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{awemeIds}")
    public AjaxResult remove(@PathVariable String[] awemeIds)
    {
        return toAjax(drBaseService.deleteDrBaseByAwemeIds(awemeIds));
    }
}
